Xbasic

FILTER_STRING_MULTI Function

Syntax

Output_List as C = filter_string_multi(C string ,C sub_strings [,C delimiter [,L exclude ]])

Arguments

Output_List

All elements of Input_List that either include or do not include all elements found in the Filter_List.

string

The list to examine.

sub_strings

The list of elements that must be found or not found in Input_List.

delimiter

Optional. Default = CR-LF. The delimiter between elements in the Input_List and Filter_List.

exclude

Logical. Optional. Default = .F. .T. = Return Input_List items that do not include elements of Filter_List. .F. = Return Input_List items that include elements of Filter_List.

Description

Filter in/out words that contain any case insensitive words in delimiter delimited sub_strings from a list, default delimiter is CR-LF.

Discussion

Takes an Input_List that is divided into logical "records" by a Delimiter and either extracts or excludes the "records" that contain one or more filter elements anywhere within each "record" in the string. Used to extract a list from a larger text file. The FILTER_STRING_MULTI() function returns all elements of an Input_List that either include or do not include all elements found in the Filter_List.

Example

inlist = <<%a%
Alpha Software
The Alpha Project
Project Alpha
%a%
outlist = <<%b%
the
software
%b%
? filter_string_multi(inlist, outlist, crlf() , .f.)
= The Alpha Project
Alpha Software
? filter_string_multi(inlist, outlist, crlf() , .t.)
= Project Alpha

See Also